<template>
	<view class="ship-popup" v-if="suitDetail.room.title">
		<view class="title">{{suitDetail.room.title}}<view @click="closePopup" class="iconfont">&#xe688;</view></view>
		<scroll-view class="scroll-con" :scroll-y="true">
			<view class="swiper" v-if="suitDetail.room.piclist">
				<swiper class="popup-swiper" @change="couponSwiperChange">
					<swiper-item v-if="suitDetail.room.video">
						<video class="video" :src="suitDetail.room.video" :controls="true" enable-progress-gesture="false" show-center-play-btn="disable" ></video>
					</swiper-item>
					<swiper-item v-for="(item,index) in suitDetail.room.piclist" :key="index">
						<image :src="item" mode="aspectFill"></image>
					</swiper-item>
				</swiper>
				<view class="number-plan" v-if="suitDetail.room.video"><text class="iconfont">&#xe68a;</text>{{couponCurrent}}/{{suitDetail.room.piclist.length+1}}</view>
				<view class="number-plan" v-else><text class="iconfont">&#xe68a;</text>{{couponCurrent}}/{{suitDetail.room.piclist.length}}</view>
			</view>
			<view class="detail-content">
				<view class="ship-detail-info">
					<view class="item detail">
						<!-- <view class="c-title">房型详情</view> -->
						<view class="content">
							<view class="con-item">
								<text class="label">房型名称：</text>
								<view class="labelcon">{{suitDetail.room.title}}</view>
							</view>
							<view class="con-item">
								<text class="label">房型类别：</text>
								<view class="labelcon">{{suitDetail.room.kind_name}}</view>
							</view>
							<view class="con-item">
								<text class="label">房型结构：</text>
								<view class="labelcon">{{suitDetail.room.structure}}</view>
							</view>
							<view class="con-item">
								<text class="label">房型面积：</text>
								<view class="labelcon">{{suitDetail.room.area}}平米</view>
							</view>
							<view class="con-item">
								<text class="label">房间库存：</text>
								<view class="labelcon">{{suitDetail.room.num}}</view>
							</view>
							<view class="con-item">
								<text class="label">床型：</text>
								<view class="labelcon">{{suitDetail.room.bed}}</view>
							</view>
							<view class="con-item">
								<text class="label">可住人数：</text>
								<view class="labelcon">{{suitDetail.room.peoplenum}}</view>
							</view>
							<view class="con-item">
								<text class="label">窗型：</text>
								<view class="labelcon">
									<block v-if="suitDetail.room.iswindow == '0'">无窗</block>
									<block v-else>有窗</block>
								</view>
							</view>
							<view class="con-item">
								<text class="label">所在楼层：</text>
								<view class="labelcon">{{suitDetail.room.floors}}</view>
							</view>
							<view class="con-item">
								<text class="label">设施描述：</text>
								<view class="labelcon"><jyf-parser :html="suitDetail.room.content"></jyf-parser></view>
							</view>
						</view>
					</view>
				</view>
			</view>
		</scroll-view>
	</view>
</template>

<script>
	/**
	 * 房型详情
	 * 
	 */
	import jyfParser from "@/components/jyf-parser/jyf-parser";
	export default {
		components:{
			jyfParser
		},
		name: 'stShipDetailInfo',
		props: {
			suitDetail:{
				type:Object,
				default(){
					return {}
				}
			},
			price:{
				type:String,
				default: ''
			},
		},
		data() {
			return {
				couponCurrent: 1,//弹窗swiper
			};
		},
		methods: {
			getStr(item){
				let arr = [];
				for (let i of item) {
					if(i.isshow){
						arr.push(i.attrname)
					}
				}
				return arr.join(',')
			},
			// 舱房弹窗swiper
			couponSwiperChange(e){
				this.couponCurrent=e.detail.current+1
			},
			
			closePopup(){
				this.$emit('close')
			}
		}
	}
</script>

<style lang="scss">
	.ship-popup{
		background-color: $uni-bg-color;
		font-size: $uni-font-size-sm;
		.title{
			@extend .ellipse;
			position: relative;
			height: 86rpx;
			padding: 0 3em;
			line-height: 86rpx;
			font-size: $uni-font-size-lg;
			text-align: center;
			border-bottom: 1rpx solid $uni-border-color;
			.iconfont{
				position: absolute;
				right: 25rpx;
				top: 0;
			}
		}
		.scroll-con{
			max-height: 900rpx;
			min-height: 100rpx;
			// overflow-y: auto;
		}
		.swiper{
			position: relative;
			.popup-swiper,image{
				height: 400rpx;
			}
			image{
				width: 100%;
			}
			.video{
				width: 100%;
				height: 100%;
			}
			.number-plan{
				position: absolute;
				right: 25rpx;
				bottom: 20rpx;
				width: 114rpx;
				height: 40rpx;
				@extend .alignJustify;
				border-radius: 20rpx;
				background-color: rgba(0,0,0,.6);
				color: $uni-text-color-inverse;
				.iconfont{
					margin-right: 10rpx;
					font-size: 28rpx;
				}
			}
		}
		.detail-content{
			padding: 0 25rpx;
		}
		.attr-list{
			padding: 25rpx 0 17rpx;
			border-bottom: 1rpx solid $uni-border-color;
			font-size: $uni-font-size-mini;
			.list-con{
				@extend .displayflex;
				flex-wrap:wrap;
				margin-left: -8rpx;
			}
			.first,.item{
				height: 30rpx;
				margin: 0 0 8rpx 8rpx;
				padding: 0 12rpx;
				border-radius: 3rpx;
			}
			.first{
				line-height: 30rpx;
				color: #ff8800;
				background-color: #fff3e5;
			}
			.item{
				box-sizing: border-box;
				line-height: 28rpx;
				color: $uni-text-color-primary;
				border: 1rpx solid $uni-color-primary;
			}
		}
		.ship-detail-info{
			.c-title{
				margin-bottom: 24rpx;
				font-size: $uni-font-size-base;
			}
			.item{
				padding: 30rpx 0 20rpx;
				border-bottom: 1rpx solid $uni-border-color;
				&.detail{
					.c-title{
						margin-bottom: 6rpx;
					}
					.content{
						@extend .displayflex;
						flex-wrap:wrap;
						line-height: 2;
						color: $uni-text-color;
					}
					.con-item{
						@extend .justifyspacec;
						align-items: flex-start;
						width: 100%;
						padding: 10rpx 0;
						line-height: 30rpx;
						.label{
							display: block;
							width: 120rpx;
							text-align: right;
						}
						.labelcon{
							width: 580rpx;
						}
					}
				}
				.content{
					line-height: 1.5;
					color: $uni-text-color-deep;
				}
				&:last-child{
					border-bottom: none;
				}
			}
		}
	}
</style>
